<%--
  Created by IntelliJ IDEA.
  User: cyy
  Date: 2022/12/4
  Time: 1:28
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="com.cyy.bean.record" %>
<%@ taglib prefix="rapid" uri="http://www.rapid-framework.org.cn/rapid" %>
<!DOCTYPE html>
<html>
<head>
    <title>收货信息确认</title>
</head>
<body>
    <rapid:override name="titleContent">
        <h2 align="center" style="left: 30%">您购买了以下物品，请确认收货</h2>
    </rapid:override>
    <rapid:override name="btContent">
        <div align="center">
            <button onclick="returnToIndex()">回到首页</button>
        </div>
    </rapid:override>
    <rapid:override name="mainContent">
    <div class="cart-page" align="center">
        <div class="container-fluid">
            <div class="row" >
                    <div class="cart-page-inner">
                        <div class="table-responsive">
                            <table class="table table-bordered">
                                <thead class="thead-dark">
                                <tr>
                                    <th>下单时间</th>
                                    <th>联系方式</th>
                                    <th>地址</th>
                                    <th>确认收货</th>
                                    <th>详情</th>
                                </tr>
                                </thead>
                                <tbody class="align-middle" align="center">
<%--                                获取不同的下单时间--%>
                                    <%ArrayList<String> times=(ArrayList<String>)request.getAttribute("times");
                                        if(times!=null)
                                        {%>
                                            <%for(int j=0;j<times.size();j++)
                                            {%>
                                            <tr>
                                                <td><%=times.get(j)%></td>
                                                <%
                                                ArrayList<record> records=(ArrayList<record>)request.getAttribute("records");
                                                if(records!=null)
                                                {%>
                                                <td><%=request.getAttribute("phone")%></td>
                                                <td><%=request.getAttribute("address")%></td>
                                                <td><button onclick="confirm1('<%=times.get(j)%>')" style="width: auto">确认</button></td>
                                                <td>
<%--                                            每一行只显示具有相同下单时间的数据--%>
                                                <%
                                                for(int i=0;i<records.size();i++){
                                                    if(records.get(i).getTime().equals(times.get(j)))
                                                    {%>
                                                       <%=records.get(i).getNum()%>件<%=records.get(i).getProductName()%>  共<%=records.get(i).getPrice()*records.get(i).getNum()%>元,
                                                    <%}
                                                    }%>
                                                <%}%>
                                                </td>
                                                </tr>
                                            <%}}%>
                                </tbody>
                            </table>
                        </div>
                    </div>
            </div>
        </div>
    </div>
    </rapid:override>
    <%@ include file="customerProductIndex.jsp"%>
</body>
</html>
